pre {
  white-space: pre-wrap;
}

.font-bold {
  font-weight: bold;
}

table.results-table,
.divTable {
  border: 1px solid var(--table-border-color);
  border-collapse: collapse;
  width: 100%;

  margin: 1rem 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.results-table ins {
  background-color: var(--insert-highlight-color);
  text-decoration: none;
}

.results-table del {
  background-color: var(--delete-highlight-color);
  text-decoration: strikethrough;
}

.tr {
  display: flex;
}

.results-table tr,
.tr {
  width: fit-content;
}

.results-table tr:hover,
.tr:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.results-table th,
.th,
.results-table td,
.td {
  position: relative;
  box-shadow: inset 0 0 0 1px var(--border-color);
  vertical-align: top;

  padding: 1rem;
}

.compact.results-table th,
.compact .th,
.compact.results-table td,
.compact .td {
  padding: 0.5rem;
}

.results-table th.variable,
.th.variable,
.results-table td.variable,
.td.variable {
  background-color: var(--variable-background-color);
}

.results-table tr.header {
  background-color: var(--header-background-color);
}

.results-table th,
.th {
  padding: 1rem;
  position: relative;
  vertical-align: bottom;
  text-align: left;
  white-space: pre-wrap;
  font-weight: normal;
}

.results-table th .action {
  cursor: pointer;
  margin-left: 0.5rem;
}

.results-table th .action svg {
  vertical-align: middle;
}

/* https://stackoverflow.com/questions/36575846/how-to-make-div-fill-td-height-in-firefox/36576083#36576083 */
.results-table td,
.results-table th {
  height: 1px;
}

@-moz-document url-prefix() {
  /* Firefox fix */
  .results-table td,
  .results-table th {
    height: 100%;
  }
}

.firefox-fix {
  /* Seems to be needed on the entire table for Firefox to render the table correctly. When applied to a div within a specific td or th, it breaks the element but fixes the other rows */
  display: table;
  height: 100%;
}

.results-table tr .cell {
  display: flex;
  flex-direction: column;
  white-space: pre-wrap;
  height: 100%;
}

.results-table tr .cell img {
  max-width: 256px;
  max-height: 256px;
  cursor: pointer;
}

.results-table tr .variable > *,
.compact.results-table tr .cell > * {
  /* Header and vars always inline, cells are inline in compact mode. */
  display: inline;
}

.results-table tr .cell .prompt {
  background-color: var(--variable-background-color);
  border: 1px solid var(--border-color);
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8rem;
}

.results-table tr .cell .prompt .pill {
  display: block;
  background-color: var(--neutral-background-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.25rem;
  width: fit-content;
  margin-bottom: 0.5rem;
}

.results-table tr .cell-actions {
  display: flex;
  gap: 0.5rem;
  visibility: hidden;
  position: absolute;
  top: 1.25rem;
  right: 0.75rem;
  line-height: 0;
  font-size: 1.25rem;
}

.results-table tr:hover .cell-actions {
  visibility: visible;
}

.results-table tr .cell-detail {
  display: flex;
  flex-wrap: wrap;
  column-gap: 0.5rem;
  row-gap: 0.25rem;

  padding-top: 1rem;
  margin-top: auto; /* Floats element to the bottom of the container */
}

.results-table tr .stat-item {
  font-weight: normal;
  font-size: 0.75rem;
  color: #888;
}

.results-table tr .cell-actions .action {
  cursor: pointer;
}

.results-table th .output-header {
  display: flex;
  flex-direction: column;
  height: 100%;
  align-items: flex-start;
}

.results-table th .output-header .pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.results-table th .prompt-container {
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.results-table th .prompt-container > * {
  display: inline;
}

.results-table th .provider {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background-color: var(--neutral-background-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  margin-right: 0.25rem;
}

.results-table th .summary {
  font-weight: normal;
}

.results-table th .prompt-detail {
  display: flex;
  flex-wrap: wrap;
  column-gap: 0.5rem;
  row-gap: 0.25rem;

  font-size: 0.75rem;
  color: #888;
  margin-top: auto; /* Floats element to the bottom of the container */
}

.results-table th .summary .highlight {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  background-color: var(--fail-background-color);
  border: 1px solid var(--border-color);
}

.results-table th .summary .highlight.success {
  background-color: var(--success-background-color);
  border: 1px solid var(--pass-color);
}

.results-table .status {
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.results-table .status .pill {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  margin-right: 0.25rem;
}

.results-table .pass .pill {
  background-color: var(--success-background-color);
  color: var(--pass-color);
  border: 1px solid var(--pass-color);
}

.results-table .fail .pill {
  border: 1px solid var(--fail-color);
}

.results-table .fail {
  color: var(--fail-color);
}

.fail-reason {
  color: var(--fail-color);
  font-weight: bold;
}

.compact .fail-reason {
  display: inline;
}

.results-table .fail .pill {
  background-color: var(--fail-background-color);
}

.results-table td .score {
  font-weight: normal;
}

.results-table .comment {
  margin-top: 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  background-color: var(--neutral-background-color);
  font-style: italic;
  cursor: pointer;
}

.first-prompt-col {
  border-left: 2px solid #888;
}

.first-prompt-row {
  border-top: 2px solid #888;
}

.search-highlight {
  color: var(--search-text-color);
  background-color: var(--search-highlight-color);
}

.results-table tr .cell .lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.results-table tr .cell .lightbox img {
  max-width: 90%;
  max-height: 90%;
}

.resizer {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 5px;
  cursor: col-resize;
  user-select: none;
  touch-action: none;

  background: var(--text-color);
  opacity: 0.5;
}

.resizer.isResizing {
  background: var(--text-color);
  opacity: 1;
}

@media (hover: hover) {
  .resizer {
    opacity: 0;
  }

  *:hover > .resizer {
    opacity: 1;
  }
}
